package model.entities;

import java.awt.Color;

/**
 * The world representation of a laser source
 * 
 * @author ben
 *
 */
public class LaserSource implements IEntity {
	
	private static final Color DEFAULT_COLOR = Color.RED;
	private static final Direction DEFAULT_DIRECTION = Direction.TOP;

	private Color color;
	private Direction directon;
	private boolean directionLocked = false;
	
	public LaserSource(Color color, Direction direction) {
		this.color = color;
		this.directon = direction;
	}
	
	public LaserSource() {
		this.color = DEFAULT_COLOR;
		this.directon = DEFAULT_DIRECTION;
	}
	
	@Override
	public Direction handleLaserBeam(Direction inDirection, Color beamColor) {
		return null; // blocks beam
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Direction getDirecton() {
		return directon;
	}

	public void setDirecton(Direction directon) {
		this.directon = directon;
	}

	public boolean isDirectionLocked() {
		return directionLocked;
	}

	public void setDirectionLocked(boolean directionLocked) {
		this.directionLocked = directionLocked;
	}

	@Override
	public void handleClick(int button) {
		
		if(directionLocked)
			return;
		
		switch (button) {
		case 1 : this.setDirecton(this.getDirecton().increment()); break;
		case 3 : this.setDirecton(this.getDirecton().decrement()); break;
		}
		
	}

}
